<template>
 <div>
   <el-row>
     <el-col :span="24">
     <el-card class="box">
     <el-tree
  :data="data"
  node-key="id"
  :default-expanded-keys="[2, 3,8]"
  :props="defaultProps">
</el-tree>
     </el-card>
     </el-col>
   </el-row>
 </div>
</template>

<script>
export default {
    data() {
      return {
        data: [{
          id: 1,
          label: '家用电器',
          children: [{id: 4,label: '电视'}],
        }, {
          id: 2,
          label: '手机数码',
          children: [{id: 5,label: '手机通讯'}, {id: 6,label: '运营商'}]
        }, {
          id: 3,
          label: '电脑办公',
          children: [{
            id: 7,
            label: '电脑整机'
          }, {
            id: 8,
            label: '电脑配件',
            children:[{id:81,label:'显示器'},{id:82,label:'CPU'}]
          }]
        }],
        defaultProps: {
          children: 'children',
          label: 'label'
        }
      };
    }
}
</script>

<style>
.box{
  width: 100%;
}
</style>